#include <iostream>
using namespace std;

int partition(int arr[],int low,int high) {
    int mid = arr[low];
    while (low < high) {
        while (low < high && mid <= arr[high])
            high--;
        arr[low] = arr[high];
        while (low < high && mid >= arr[low])
            low++;
        arr[high] = arr[low];
    }
    arr[low] = mid;
    return low;
}

void quickSort(int arr[],int low, int high) {

    if (low < high) {
        int mid = partition(arr,low,high);
        quickSort(arr,low,mid-1);
        quickSort(arr,mid+1,high);
    }
}



int main() {
    int A[10] = {1,5,8,3,2,1,6,9,4,7};
    //A = {1,1,2,3,4,5,6,7,8,9};
    //S1 = {1,1,2,3,4}
    //S2 = {5,6,7,8,9}
    quickSort(A,0,10);
    int S1[5];
    int S2[5];
    for (int i = 0; i < 10; ++i) {
        if (i < 5)
            S1[i] = A[i];
        else
            S2[i % 5] = A[i];
    }
    cout<<"S1 :  " ;
    for (int i = 0; i < 5; ++i) {
        cout<< S1[i];
    }
    cout<<endl;
    cout<<"S2 :  " ;
    for (int i = 0; i < 5; ++i) {
        cout << S2[i];
    }
    cout<<endl;
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
